#ifndef UI_H_
#define UI_H_

#include <wx/wx.h>
#include "../base/base.h"
#include "../simulator/simulator.h"
#include <deque>

#include <wx/image.h>
#include "wx/intl.h"
#include <wx/listctrl.h>

class FrmMain;		//Main Window
class FrmSetting;	//Setting Dialog
class FrmEdit;

#define PATH_START	wxT("res\\start.png")
#define PATH_STOP	wxT("res\\stop.png")
#define PATH_CFG	wxT("res\\cfg.png")

class FrmMain
	: public wxFrame
{
public:
	explicit FrmMain(const wxString& title, const wxSize& size = wxDefaultSize);
	~FrmMain();
	
private:
	void init();
	void OnTBStart(wxCommandEvent& event);
	void OnTBCfg(wxCommandEvent& event);
	void OnInit(wxWindowCreateEvent& event);
	void OnClose(wxWindowDestroyEvent& event);
	
private:
	void CALLBACK_OnStatus(void *p);
	void CALLBACK_OnSend(void *p);
	
private:
	wxToolBar 		*m_pToolBar;
	wxStatusBar 	*m_pStatusBar;
	wxTextCtrl		*m_pTextCtrl;
	
private:
	wxBitmap		*m_pBmpStart;
	wxBitmap		*m_pBmpStop;
	wxBitmap		*m_pBmpCfg;
	
private:
	enum
	{
		ID_TB_START = 0,
		ID_TB_CFG
	};
	
private:
	Simulator 		*m_pSimulator;
	
private:
	DECLARE_EVENT_TABLE()
};

/* class FrmSetting
	: public wxDialog
{
public:
	explicit FrmSetting(const wxString& title, const wxSize& size = wxDefaultSize);
	~FrmSetting();
	
private:
	DECLARE_EVENT_TABLE()
}; */

// end wxGlade

// begin wxGlade: ::extracode
// end wxGlade

static const uint8 DOW[] = {1, 2, 3, 4, 5, 6, 0};

class FrmSetting: public wxDialog {
public:
    // begin wxGlade: FrmSetting::ids
    // end wxGlade

    FrmSetting(wxWindow* parent, Simulator *p, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE);

private:
    // begin wxGlade: FrmSetting::methods
    void set_properties();
    void do_layout();
    // end wxGlade

protected:
    // begin wxGlade: FrmSetting::attributes
    wxComboBox* combo_box_1;
    wxListCtrl* list;
    wxButton* add;
    wxButton* del;
    wxButton* edit;
    wxButton* ok;

private:
	enum
	{
		ID_BTN_ADD = 0,
		ID_BTN_DEL,
		ID_BTN_EDIT,
		ID_BTN_OK,
		ID_CMB_DOW,
		ID_LIST
	};

private:
	void OnAdd(wxCommandEvent& event);
	void OnDel(wxCommandEvent& event);
	void OnEdit(wxCommandEvent& event);
	void OnOK(wxCommandEvent& event);
	void OnSelect(wxCommandEvent& event);
	void OnActive(wxListEvent& event);
	
private:
	void InitList();
	void ShowList(uint8 nDow);

private:
	Simulator 		*m_pSimulator;
	
private:
	DECLARE_EVENT_TABLE()
    // end wxGlade
}; // wxGlade: end class

class FrmEdit: public wxDialog {
public:
    // begin wxGlade: FrmEdit::ids
    // end wxGlade

    FrmEdit(wxWindow* parent, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE);

private:
    // begin wxGlade: FrmEdit::methods
    void set_properties();
    void do_layout();
    // end wxGlade

	
private:
	enum
	{
		ID_BTN_TIME = 0,
		ID_BTN_DATA,
		ID_BTN_COMMENT,
		ID_BTN_OK,
		ID_BTN_CANCEL
	};
	
	void OnOK(wxCommandEvent& event);
	
public:
    // begin wxGlade: FrmEdit::attributes
    wxStaticText* label_1;
    wxTextCtrl* txtTime;
    wxStaticText* label_2;
    wxTextCtrl* txtData;
    wxStaticText* label_3;
    wxTextCtrl* txtComment;
    wxButton* OK;
    wxButton* CANCEL;
    // end wxGlade

private:
	DECLARE_EVENT_TABLE()
}; // wxGlade: end class

#endif